import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class MyArrayList {
    private int[] elem;
    private int UseSize;
    public  MyArrayList(int initcapicity){
        this.elem=new int[initcapicity];
    }
    public boolean isFull(){
        if(this.elem.length==this.UseSize){
            return true;
        }
        else{
            return false;
        }
    }
    public void add(int data) {
        if(isFull()){
            this.elem=Arrays.copyOf(this.elem,this.elem.length*2);
            System.out.println("扩容成功！");
        }
        this.elem[this.UseSize]=data;
        this.UseSize++;
    }
// 在 pos 位置新增元素
         public void add(int pos, int data) {
            if(pos<0||pos>UseSize){
                throw new RuntimeException(pos+"位置异常");
            }
             if(isFull()){
                 this.elem=Arrays.copyOf(this.elem,this.elem.length*2);
                 System.out.println("扩容成功！");
             }
             for (int i = UseSize-1; i >=pos; i--) {
                 elem[i+1]=elem[i];
             }
             elem[pos]=data;
             UseSize++;
         }
 // 判定是否包含某个元素
    public boolean contains(int toFind) {
        for (int i = 0; i < elem.length; i++) {
            if(toFind==elem[i]){
                return true;
            }
        }
        return false;
    }
 // 查找某个元素对应的位置
    public int indexOf(int toFind) {
        for (int i = 0; i < elem.length; i++) {
            if(toFind==elem[i]){
                return i;
            }
        }
        return -1;
    }
 // 获取 pos 位置的元素
    public int get(int pos) {
       checkPos(pos);
        return this.elem[pos];
    }
 // 给 pos 位置的元素设为 value
    public void set(int pos, int value) {
        checkPos(pos);
        elem[pos]=value;
    }
 //删除第一次出现的关键字key
    public void remove(int toRemove) {
        if(indexOf(toRemove)==-1){
            System.out.println("没有这个数据哦");
            return;
        }
        int index=0;
        index=indexOf(toRemove);
        for (int i =index; i < this.UseSize-1; i++) {
            elem[i]=elem[i+1];
        }
        UseSize--;
    }
 // 获取顺序表长度
    public int size() {
        return UseSize;
    }
 // 清空顺序表
    public void clear() {
        this.UseSize=0;
    }

         // 打印顺序表，注意：该方法并不是顺序表中的方法，为了方便看测试结果给出的
     public void display() {
        for (int i = 0; i < UseSize; i++) {
            System.out.print(elem[i]+" ");
        }
         System.out.println();
    }
    private void checkPos(int pos){
        if(pos<0||pos>=UseSize){
            throw new RuntimeException(pos+"位置异常");
        }
    }

    public static ArrayList<Character> fun(String str1,String str2){
        List<Character>list=new ArrayList<>();
        for (int i = 0; i < str1.length(); i++) {
            char ch=str1.charAt(i);
            if(!str2.contains(ch+"")){
                list.add(ch);
            }
        }
        return (ArrayList<Character>) list;
    }
    public  static List<List<Integer>> generate(int numRows) {
        List<List<Integer>> ret = new ArrayList<>();
        List<Integer> row = new ArrayList<>();
        row.add(1);
        ret.add(row);
        for (int i = 1; i < numRows; i++) {
            List<Integer> curRow = new ArrayList<>();
            curRow.add(1);

            List<Integer> prevRow = ret.get(i - 1);
            for (int j = 1; j < i; j++) {
                int x = prevRow.get(j) + prevRow.get(j - 1);
                curRow.add(x);
            }
            curRow.add(1);
            ret.add(curRow);
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int numRows= scanner.nextInt();
        List<List<Integer>>ret=generate(numRows);
        for (int i =0; i < numRows; i++) {
            System.out.println(ret.get(i));
        }
    }
    public static void main4(String[] args) {
        String s1="welcome to baidu";
        String s2="come";
        ArrayList<Character> list = fun(s1, s2);
        System.out.println(list);
        for (char ch:
             list) {
            System.out.print(ch);
        }

    }
    public static void main2(String[] args) {
        ArrayList<Integer> list=new ArrayList<>(15);
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        list.add(5);
        //list.remove(new Integer(2));
        System.out.println(list);
        List list2=list.subList(1,3);
        System.out.println(list2);
        list2.set(0,99);
        System.out.println(list);
    }
    public static void main1(String[] args) {
        MyArrayList myArrayList=new MyArrayList(3);
        myArrayList.add(1);
        myArrayList.add(2);
        myArrayList.add(3);
        myArrayList.add(4);
        myArrayList.display();
        myArrayList.set(0,99);
        myArrayList.display();
        myArrayList.remove(99);
        myArrayList.display();
    }
}
